<extend name="Layout/ins_page" />
<block name="content">
    <!--Begin-->
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <title>银行福利平台</title>
        <script type="text/javascript" src="/Public/Scripts/Report/ClassicReports1/jquery-1.3.1.min.js"></script>
        <script type="text/javascript" src="/Public/Scripts/Report/ClassicReports1/jquery-ui-1.7.1.custom.min.js"></script>
        <script type="text/javascript" src="/Public/Scripts/Report/ClassicReports1/daterangepicker.jQuery.js"></script>
        <link type="text/css" rel="stylesheet" 	href="/Public/CSS/Report/ClassicReports1/main.css" />
        <link rel="stylesheet" href="/Public/CSS/Report/ClassicReports1/ui.daterangepicker.css" type="text/css" />
        <link rel="stylesheet" href="/Public/CSS/Report/ClassicReports1/redmond/jquery-ui-1.7.1.custom.css" type="text/css" title="ui-theme" />
        <script language="javascript" type="text/javascript" src="/Public/Scripts/Report/ClassicReports1/tablesort2/jquery.tablesorter.min.js"></script>
        <script type="text/javascript">
            $(document).ready(function() {
                $("#mytable").tablesorter({
                    headers: {
                        0:{sorter:"string"},
                        1:{sorter:"string"},
                        2:{sorter:"currency"},
                        3:{sorter:"currency"},
                        4:{sorter:"currency"},
                        5:{sorter:"currency"},
                        5:{sorter:"currency"},
                        6:{sorter:"currency"}}
                });
            });
        </script>
        <style type="text/css">
            table{
                border-collapse:collapse;
            }

            table th{
                text-align:center;
            }
            table td{
                border:1px solid #999;
                text-align:center;
            }
            #divc{
                display: none;
            }
            .you1{
                text-align:left;
            }
        </style>
        <script type="text/javascript">
            $(function(){
                $('#rangeA').daterangepicker({arrows:true});
            });
        </script>

        <style type="text/css">
            #rangeA{ font-size:15px; }
            #rangeA{ width: 390px; height: 1.1em; }
            #rangeA{ text-align:center; }
        </style>

        <link href="/sap/demo.css" rel="stylesheet" type="text/css" />
        <script src="/sap/scripts/boot.js" type="text/javascript"></script>

    </head>
    <body onload="gehang()">

    <form id="form1" name="form1" method="get" action="/Report/classicreports1excel/">

        <div align="center">
            <!--<input type="text" name="time" value="<?php echo $time;?>" id="rangeA"/>-->
            <input name="FromDate" id="FromDate" class="mini-datepicker" format="yyyy-MM-dd " showTime="true" valueType='string'
                   value="<?php echo date('Y-m-d', time() - 86400 * 7) ?>"/>
            <input name="ToDate" id="ToDate" class="mini-datepicker" format="yyyy-MM-dd " showTime="true" valueType='string'
                   value="<?php echo date('Y-m-d', time() - 86400 * 7) ?>"/>
        </div>

        <table width="450"border="0" align="center">
            <tr onclick="TestBlack('divc');">
                <td width="480" bgcolor="#294083">
                    <div style="color:white">选择平台</div>
                    <div style="color:white" id="tips"><?php if($check=='ALL') {echo  $check;}else{ echo $options1[0];} ?></div>
                    <div id="tips">
                    </div></td>
            </tr>
            <tr id="divc">
                <td>
                    <table align="center">
                        <tr>
                            <td align="center" width="50">
                                类别
                            </td>
                            <td id="leibie"  width="450" colspan="3" class="you1">
                                <input type="button" id="yd" onclick="yd1('')" value="移动"><input type="button" id="jc" onclick="jc1('')" value="集采"><input type="button" id="jf" onclick="jf1('')" value="积分商城"><input type="button" id="fq" onclick="fq1('')" value="分期商城">
                            </td>
                        </tr>
                        <tr>
                            <td align="center" width="30">
                                人员
                            </td>
                            <td id="renyuan"  width="450" colspan="3" class="you1">
                                <input type="button" id="se" onclick="se1('')" value="Abyss"><input type="button" id="su" onclick="su1('')" value="Sue"><input type="button" id="yi" onclick="yi1('')" value="Yina"><input type="button" id="lo" onclick="lo1('')" value="Louise"><input type="button" id="to" onclick="to1('')" value="Tony">
                            </td>
                        </tr>
                        <tr>
                            <td align="center" width="30">
                                选择
                            </td>
                            <td  width="450" colspan="3" class="you1" >
                                <input type="button" id="qx" onclick="xuan('qx')" value="全选"><input type="button" id="fx" onclick="xuan('fx')" value="反选">
                            </td>
                        </tr>
                        </td>
                        </tr>

                        <?php

	foreach($options as $key => $pt){

	    echo "<tr class=\"content\" width=\"20\">";
                        echo "<td width='40'><input type='checkbox' name='check[]' value='".$pt['CardCode']."' checked></td>";
                        echo "<td class=\"jg\" width=\"240\">".$pt['ShortName']."</td>";
                        echo "<td class=\"fs\" width=\"100\">".$pt['ChannelType']."</td>";
                        echo "<td class=\"czr\" width=\"100\">".$pt['CManager']."</td>";
                        echo "</tr>";
                        }

                        ?>



                    </table>
                </td>
            </tr>
        </table>
        <div align="center">
            <input type="submit" name="Submit" value="提交"/>
        </div>
    </form>

    <p>

    <div>
        <table border="1"  id="mytable" cellspacing="0" align="center" ><thead>
        <tr >
            <th  style="width:16%"><div align="center">产品经理</div></th><th style="width:12%"><div align="center">产品组</div></th><th  style="width:12%"><div align="center">数量</div></th> <th  style="width:12%"><div align="center">销售金额</div></th> <th  style="width:12%" ><div align="center">销售毛利</div></th><th  style="width:12%" ><div align="center">毛利率%</div></th>
        </tr>
        </thead>
            <tbody>

            <foreach name="summerData" item="item">

            <tr align="center">
                <td><?php echo "<a href=#>".iconv("gb2312","utf-8//IGNORE",$item['pmanager'])."</a>";?></td>
                <td><?php echo iconv("gb2312","utf-8//IGNORE",$item['U_LEADER']);?></td>
                <td><?php echo number_format(round($item['SUMQTY'],0));?></td>
                <td><?php echo number_format(round($item['SUMPRICE'],2));?></td>
                <td><?php if (round($item['PROFIT'],2)<0){echo "<font color='FF6633'>".number_format(round($item['PROFIT'],2))."</font>" ;} else {echo "<font color='000099'>".number_format(round($item['PROFIT'],2))."</font>"; } ?></td>
                <td><?php if (round($item['PROFIT'],2)<0){echo "<font color='FF6633'>".round($item['PROFIT']/$item['SUMPRICE']*100,2)."</font>" ;} else {echo "<font color='000099'>".round($item['PROFIT']/$item['SUMPRICE']*100,2)."</font>"; } ?></td>
            </tr>

            </foreach>

            </tbody>
        </table>
    </div>
    </p>
    <p>

    <div>
        <!--<table border="1"  id="mytable1" cellspacing="0" align="center">-->
            <!--<thead>-->
            <!--<tr >-->
                <!--<th style="width:12%"><div align="center">产品组</div></th><th  style="width:12%"><div align="center">数量</div></th> <th  style="width:12%"><div align="center">销售金额</div></th> <th  style="width:12%" ><div align="center">销售毛利</div></th>-->
            <!--</tr>-->
            <!--</thead>-->
        <!--</table>-->

    </p>
    </body>
    <script>
        function gehang(){
//获取tr节点
            var tr=document.getElementsByTagName("tr");
//为第一行添加背景颜色
            tr[0].style.background="#fa1d23";


        }
        //创建全选反选函数
        function xuan(type){
//获取name值
            var qcheck=document.getElementsByName("check[]");
//获取选的按钮
            if(type=="qx"){
                for(var i=0;i<qcheck.length;i++){

                    qcheck[i].checked=true;
                }
            }
            if(type=="fx"){
                for(var i=0;i<qcheck.length;i++){
                    qcheck[i].checked=false;
                }
            }

            if(type=="qxx"){
                for(var i=0;i<qcheck.length;i++){
                    if(qcheck[i].checked){
                        qcheck[i].checked=false;
                    }
                    else{
                        qcheck[i].checked=true;

                    }
                }
            }
        }

        function fq1(){
            var sex=document.getElementsByClassName("fs");
            var inputs=document.getElementsByName("check[]");
            for(var i=0;i<sex.length;i++){
                if(sex[i].innerHTML=='分期商城'){
                    inputs[i].checked=!inputs[i].checked;
                }else{
                    inputs[i].checked=false;
                }

            }
        }
        function jf1(){
            var sex=document.getElementsByClassName("fs");
            var inputs=document.getElementsByName("check[]");
            for(var i=0;i<sex.length;i++){
                if(sex[i].innerHTML=='积分商城'){
                    inputs[i].checked=!inputs[i].checked;
                }else{
                    inputs[i].checked=false;
                }

            }
        }
        function yd1(){
            var sex=document.getElementsByClassName("fs");
            var inputs=document.getElementsByName("check[]");
            for(var i=0;i<sex.length;i++){
                if(sex[i].innerHTML=='移动'){
                    inputs[i].checked=!inputs[i].checked;
                }else{
                    inputs[i].checked=false;
                }

            }
        }
        function jc1(){
            var sex=document.getElementsByClassName("fs");
            var inputs=document.getElementsByName("check[]");
            for(var i=0;i<sex.length;i++){
                if(sex[i].innerHTML=='集采'){
                    inputs[i].checked=!inputs[i].checked;
                }else{
                    inputs[i].checked=false;
                }

            }
        }
        function ca1(){
            var sex=document.getElementsByClassName("czr");
            var inputs=document.getElementsByName("check[]");
            for(var i=0;i<sex.length;i++){
                if(sex[i].innerHTML=='Caroline'){
                    inputs[i].checked=!inputs[i].checked;
                }else{
                    inputs[i].checked=false;
                }

            }
        }
        function se1(){
            var sex=document.getElementsByClassName("czr");
            var inputs=document.getElementsByName("check[]");
            for(var i=0;i<sex.length;i++){
                if(sex[i].innerHTML=='Abyss'){
                    inputs[i].checked=!inputs[i].checked;
                }else{
                    inputs[i].checked=false;
                }

            }
        }
        function su1(){
            var sex=document.getElementsByClassName("czr");
            var inputs=document.getElementsByName("check[]");
            for(var i=0;i<sex.length;i++){
                if(sex[i].innerHTML=='Sue'){
                    inputs[i].checked=!inputs[i].checked;
                }else{
                    inputs[i].checked=false;
                }

            }
        }
        function yi1(){
            var sex=document.getElementsByClassName("czr");
            var inputs=document.getElementsByName("check[]");
            for(var i=0;i<sex.length;i++){
                if(sex[i].innerHTML=='Yina'){
                    inputs[i].checked=!inputs[i].checked;
                }else{
                    inputs[i].checked=false;
                }

            }
        }
        function lo1(){
            var sex=document.getElementsByClassName("czr");
            var inputs=document.getElementsByName("check[]");
            for(var i=0;i<sex.length;i++){
                if(sex[i].innerHTML=='Louise'){
                    inputs[i].checked=!inputs[i].checked;
                }else{
                    inputs[i].checked=false;
                }

            }
        }
        function to1(){
            var sex=document.getElementsByClassName("czr");
            var inputs=document.getElementsByName("check[]");
            for(var i=0;i<sex.length;i++){
                if(sex[i].innerHTML=='Tony'){
                    inputs[i].checked=!inputs[i].checked;
                }else{
                    inputs[i].checked=false;
                }

            }
        }
        function TestBlack(Tgname){
            var obj = document.getElementById('divc');
            if(obj.style.display=="block"){
                obj.style.display = "none";
            }else{
                obj.style.display = "block";
            }
        }
        var table=document.getElementsByTagName('table')[0];
        var tips=document.getElementById('tips');
        table.onclick=function(e){
            var target= e.target;
            var parent=target.parentElement;
            if(target.name=='check[]'){
                checkShow('jg');
            }else if(parent.id=='leibie'){
                checkShow('fs');
            }else if(parent.id=='renyuan'){
                checkShow('czr');
            }
        };
        function checkShow(name){
            var arr=[];
            var inputs=document.getElementsByName('check[]');
            var fs=document.getElementsByClassName(name);
            for(var i=0;i<inputs.length;i++){
                if(inputs[i].checked==true){
                    var isIn=false;
                    for(var j=0;j<arr.length;j++){
                        if(arr[j]==fs[i].innerHTML){
                            isIn=true;
                        }
                    }
                    if(!isIn){
                        arr.push(fs[i].innerHTML);
                    }
                }
            }
            tips.innerHTML=arr.toString();

        }


    </script>
    </html>
    <!--End-->
</block>
<block name="js">
</block>